#nullable enable

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using PHMEE.Diagnosis;
using PHMEE.Entities.Diagnosis;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus.Distributed;

namespace PHMEE.Managers.Diagnosis;

// public interface IAlarmRecordCreatedEventPublisher : ITransientDependency
// {
//     /// <summary>
//     /// 发布报警记录创建事件
//     /// </summary>
//     /// <param name="alarmRecord"></param>
//     /// <param name="point"></param>
//     Task PublishAlarmRecordCreatedEventAsync(AlarmRecord alarmRecord, Point point);
// }
//
// public class AlarmRecordCreatedEventPublisher : IAlarmRecordCreatedEventPublisher
// {
//     private readonly IDistributedEventBus _distributedEventBus;
//
//     public AlarmRecordCreatedEventPublisher(IDistributedEventBus distributedEventBus)
//     {
//         _distributedEventBus = distributedEventBus;
//     }
//
//     /// <summary>
//     /// 发布报警记录创建事件
//     /// </summary>
//     /// <param name="alarmRecord"></param>
//     /// <param name="point"></param>
//     public async Task PublishAlarmRecordCreatedEventAsync(AlarmRecord alarmRecord, Point point)
//     {
//         var eto = new AlarmRecordCreatedEto
//         {
//             Id = alarmRecord.Id,
//             UnitId = alarmRecord.UnitId,
//             EquipId = alarmRecord.EquipId,
//             PointId = alarmRecord.PointId,
//             PointName = point.Name,
//             AlarmTimeUtc = alarmRecord.AlarmTimeUtc,
//             FaultCodes = alarmRecord.FaultCodes,
//             FeatureAlarmLevels = alarmRecord.FeatureAlarmLevels
//         };
//         await _distributedEventBus.PublishAsync(eto);
//     }
// }
//
// /// <summary>
// /// 报警记录创建事件
// /// </summary>
// public class AlarmRecordCreatedEto
// {
//     /// <summary>
//     /// AlarmRecord Id
//     /// </summary>
//     public Guid Id { get; set; }
//
//     /// <summary>
//     /// 机组 Id
//     /// </summary>
//     public Guid UnitId { get; set; }
//
//     /// <summary>
//     /// 设备 Id，只有当报警测点关联到设备时才有值
//     /// </summary>
//     public Guid? EquipId { get; set; }
//
//     /// <summary>
//     /// 报警测点 Id
//     /// </summary>
//     public Guid PointId { get; set; }
//
//     /// <summary>
//     /// 测点名称
//     /// </summary>
//     public string PointName { get; set; } = null!;
//
//     /// <summary>
//     /// 报警时间，即报警数据的时间戳 Ts
//     /// </summary>
//     public DateTime AlarmTimeUtc { get; set; }
//
//     /// <summary>
//     /// 故障码
//     /// </summary>
//     public ICollection<string> FaultCodes { get; set; } = new Collection<string>();
//
//     /// <summary>
//     /// 特征值-报警等级
//     /// </summary>
//     public Dictionary<AlarmFeatureValue, AlarmLevel> FeatureAlarmLevels { get; set; } = new();
// }
